import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/Index.vue')
  },
  {
    path: '/user/list',
    name: 'userList',
    component: () => import('../views/user/list.vue')
  },
  {
    path: '/user/add',
    name: 'userAdd',
    component: () => import('../views/user/add.vue')
  },
  {
    path: '/car/list',
    name: 'carList',
    component: () => import('../views/car/list.vue')
  },
  {
    path: '/car/add',
    name: 'carAdd',
    component: () => import('../views/car/add.vue')
  },
  {
    path: '/order/list',
    name: 'orderList',
    component: () => import('../views/order/list.vue')
  },
  {
    path: '/order/add',
    name: 'orderAdd',
    component: () => import('../views/order/add.vue')
  },
  {
    path: '/check/edit',
    name: 'checkEdit',
    component: () => import('../views/check/edit.vue')
  },
  {
    path: '/check/list',
    name: 'checkList',
    component: () => import('../views/check/list.vue')
  },
  {
    path: '/carInfo/:id',
    name: 'carInfo',
    component:() =>import('../views/CarInfo.vue')
  },
  {
    path: '/user/allOrder',
    name: 'uerAllOrder',
    component:() =>import('../views/user/allOrder.vue')
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path:'/allOrder/:id',
    name:'allOrder',
    component:()=>import('../views/user/allOrder.vue')
  },
  {
    path:'/userInfo/:id',
    name:'userInfo',
    component:()=>import('../views/user/userInfo.vue')
  },
  {
    path:'/orderInfo/:id',
    name:'orderInfo',
    component:()=>import('../views/order/info.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
